package com.project.demo.controller;

import com.project.demo.entity.Affairs;
import com.project.demo.mapper.AffairsMapper;
import com.project.demo.vo.AffairsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class AffairsController {
    @Autowired
    AffairsMapper affairsMapper;

    @RequestMapping("/showaffairs")
    public AffairsVo showaffairs(){
        List<Affairs> affairs = affairsMapper.selectList(null);
        AffairsVo affairsVo=new AffairsVo();
        affairsVo.setCode(0);
        affairsVo.setData(affairs);
        affairsVo.setMsg("");
        affairsVo.setCount(affairs.size());
        return  affairsVo;
    }
    @RequestMapping("/showaffairs1")
    public List<Affairs> showaffairs1(){
        List<Affairs> affairs = affairsMapper.selectList(null);

        return  affairs;
    }
}
